mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Normalize the direction vector for rotate
This commit is contained in:
parent
cab6260c32
commit
0dd99e6bd2
1 changed files with 4 additions and 0 deletions
|
@ -664,6 +664,10 @@ fn interpolate_transform_list(from_list: &[TransformOperation],
|
|||
}
|
||||
(&TransformOperation::Rotate(fx, fy, fz, fa),
|
||||
&TransformOperation::Rotate(tx, ty, tz, ta)) => {
|
||||
let norm_f = ((fx * fx) + (fy * fy) + (fz * fz)).sqrt();
|
||||
let norm_t = ((tx * tx) + (ty * ty) + (tz * tz)).sqrt();
|
||||
let (fx, fy, fz) = (fx / norm_f, fy / norm_f, fz / norm_f);
|
||||
let (tx, ty, tz) = (tx / norm_t, ty / norm_t, tz / norm_t);
|
||||
if fx == tx && fy == ty && fz == tz {
|
||||
let ia = fa.interpolate(&ta, time).unwrap();
|
||||
result.push(TransformOperation::Rotate(fx, fy, fz, ia));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue