所以,对于我们的项目,我们必须制作一个财富之轮游戏(基于游戏节目),我做了所有事情(比如检查这个词是否正确以及所有内容)但我还是不知道如何做动画。我有动画的内容类似于附图中的内容。我们的老师告诉我们,我们不能使用画布,因此我无法使用// example of user input
var permutation = [ 9,2,3,7,4,1,8,6,5 ] ;
// add zero to match index with numbers
permutation.unshift(0) ;
// loop to check for all possible permutations
for (var i = 1; i < permutation.length -1; i++)
{
var cycle = [];
var currentIndex = i ;
if ( permutation [ currentIndex ] == i )
cycle.push(permutation [currentIndex]);
while ( permutation [ currentIndex ] !== i )
{
cycle.push( permutation [currentIndex]);
currentIndex = permutation [ currentIndex ] ;
}
// display in console
console.log(cycle);
}
。那么,有没有人对如何实现这一点有任何想法?记住,我甚至不需要轮子实际旋转;即使只是图片改变位置,它也会起作用。
以下是样本轮的图片(假装数字都是图片)。我已将所有图片存储在包含所有图片的单个数组中: https://en.m.wikipedia.org/wiki/Wheel_of_Fortune_(U.S._game_show)#/media/File%3AWheel_of_Fortune_Round_1_template_Season_31.png
PS:出于学术诚信的目的,我将无法在此处发布我的代码。
感谢您的时间,大家!
答案 0 :(得分:2)
这是一种非常基本的方式:http://codepen.io/AaronGeorge/pen/zoOWag
您使用的是CSS转换属性并使用旋转值。
你需要做一些数学运算来计算旋转图像所需的数量,但是transform: rotate(amount);
可以在不使用画布的情况下完成这项工作。