mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
parent
e995af9cff
commit
125a216bde
2 changed files with 9 additions and 3 deletions
|
@ -12,7 +12,7 @@ use euclid::point::Point2D;
|
||||||
|
|
||||||
const NEWTON_METHOD_ITERATIONS: u8 = 8;
|
const NEWTON_METHOD_ITERATIONS: u8 = 8;
|
||||||
|
|
||||||
/// A Bézier curve.
|
/// A unit cubic Bézier curve, used for timing functions in CSS transitions and animations.
|
||||||
pub struct Bezier {
|
pub struct Bezier {
|
||||||
ax: f64,
|
ax: f64,
|
||||||
bx: f64,
|
bx: f64,
|
||||||
|
@ -23,7 +23,13 @@ pub struct Bezier {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bezier {
|
impl Bezier {
|
||||||
/// Create a Bézier curve from two control points.
|
/// Create a unit cubic Bézier curve from the two middle control points.
|
||||||
|
///
|
||||||
|
/// X coordinate is time, Y coordinate is function advancement.
|
||||||
|
/// The nominal range for both is 0 to 1.
|
||||||
|
///
|
||||||
|
/// The start and end points are always (0, 0) and (1, 1) so that a transition or animation
|
||||||
|
/// starts at 0% and ends at 100%.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(p1: Point2D<f64>, p2: Point2D<f64>) -> Bezier {
|
pub fn new(p1: Point2D<f64>, p2: Point2D<f64>) -> Bezier {
|
||||||
let cx = 3.0 * p1.x;
|
let cx = 3.0 * p1.x;
|
||||||
|
|
|
@ -492,7 +492,7 @@ pub fn parse_style_attribute(input: &str,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a given property declaration. Can result in multiple
|
/// Parse a given property declaration. Can result in multiple
|
||||||
/// `PropertyDeclaration`s when expanding a longhand, for example.
|
/// `PropertyDeclaration`s when expanding a shorthand, for example.
|
||||||
pub fn parse_one_declaration(id: PropertyId,
|
pub fn parse_one_declaration(id: PropertyId,
|
||||||
input: &str,
|
input: &str,
|
||||||
base_url: &ServoUrl,
|
base_url: &ServoUrl,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue