1

I have a large wheel of div's which I rotate. I use CSS transitions to make it's movement look nice. I want to be able to set it's angle arbitrarily with JavaScript.

The problem I get is that if the angle is at zero, and I want to turn it to 270, it will turn all the way clockwise to 270. I would like for it to be "smart" and know that it is shorter to turn counterclockwise 90 degrees.

So aside from using JavaScript to calculate the proper rotation (The complexity of doing this in my situation is prohibitive) is there any way to make it "smart" about turning?

EDIT: I think I have seen something like this before, something built into CSS, but I can't seem to find it anywhere.

4

1 に答える 1

1

ダニエルがコメントしたように、唯一の方法はJavaScriptを使用することであるように思われます。

これを解決する方法は1つしか考えられません。そして、JavaScriptで計算することです。これは、値が180を超える場合、値から180を引いた値を取り、?>次にこれを引いて0にする必要があることを示します。そうすると、負の値が得られます。

于 2012-10-11T12:01:25.053 に答える