All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
CSS transitions, transforms and cubic-bezier timing
Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript
CSS can animate changes without JavaScript: transitions smooth a change between two states, transforms move, rotate and scale elements in 2D and 3D, and cubic-bezier sets the speed curve (spec 8.4.1).
Transitions
.box {
width: 100px;
height: 100px;
background-color: teal;
transition: border-radius 1s ease-in-out, background-color 0.5s;
}
.box:hover {
border-radius: 50%;
background-color: coral;
}A transition animates a property from its old value to a new one when the value changes, for example on :hover or :focus, or when JavaScript adds a class. The shorthand is transition: property duration timing-function delay;. Here the square turns into a circle over 1 second when the pointer is over it, and turns back when it leaves. The individual properties are transition-property, transition-duration, transition-timing-function and transition-delay. The transition is written on the normal state so it runs both ways.
Transforms
| Function | Effect |
|---|---|
| `rotate(7deg)` | Turns clockwise by 7 degrees (negative is anticlockwise) |
| `scale(1.5)` | Makes 1.5 times larger (scale(2, 1) doubles the width only) |
| `translate(50px, 20px)` | Moves 50px right and 20px down without affecting the layout around it |
| `skew(10deg)` | Slants the element |
| `rotateX(45deg)`, `rotateY(180deg)` | 3D: rotate round the horizontal or vertical axis |
| `translateZ(50px)` | 3D: move towards the viewer |
Several functions can be combined: transform: translate(10px, 0) rotate(45deg); transform-origin sets the pivot point
3D and cubic-bezier
3D transforms need perspective on the parent, which sets how far the viewer is from the screen (smaller values give a stronger 3D effect). A card flip uses rotateY(180deg) with backface-visibility: hidden so the back face is not seen through.
.scene { perspective: 600px; }
.card { transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55); }
.scene:hover .card { transform: rotateY(180deg); }
.sticky-note { transform: rotate(7deg); background-color: yellow; }The timing function sets how the speed changes during the transition: linear (constant), ease (default: slow, fast, slow), ease-in (starts slowly), ease-out (ends slowly), ease-in-out. cubic-bezier(x1, y1, x2, y2) defines a custom speed curve with two control points; x values must be between 0 and 1, and y values outside 0 to 1 make the element overshoot and bounce back.
Worked example
Write CSS that makes an image grow to 1.2 times its size over 0.3 seconds when the pointer moves over it.
- The change is a transform: scale(1.2) in the :hover rule.
- The transition goes on the normal state so it animates both ways.
Answer: ```css img.zoom { transition: transform 0.3s ease; } img.zoom:hover { transform: scale(1.2); } ```
Check yourself
- Which declaration turns a sticky note 7 degrees clockwise?
- rotate: 7;
- transform: rotate(7deg);
- transform: turn(7);
- transition: rotate 7deg;
Show answer
transform: rotate(7deg);. transform: rotate() takes an angle in deg; positive is clockwise.
- What does `transition: background-color 2s;` on a button do?
- The background colour changes every 2 seconds
- The button is hidden for 2 seconds
- The background colour flashes twice
- Any change to the background colour, such as on hover, happens gradually over 2 seconds
Show answer
Any change to the background colour, such as on hover, happens gradually over 2 seconds. A transition animates a property change over the duration.
- A rule says `.logo:hover { transform: rotate(360deg); }` and `.logo { transition: transform 3s; }`. Describe what the user sees.
Show answer
When the mouse pointer is over the logo it spins one full turn, taking 3 seconds, and it spins back when the pointer moves away.. The hover state triggers the rotation; the transition makes it take 3 seconds. Pearson's 2025 report noted lost marks when answers were unclear about hover versus click, or about the timing.
- Write the transform function that makes an element twice its size. Include the brackets.
Show answer
scale(2). scale(2) doubles the width and height.
- Which property, set on the parent, is needed to give 3D transforms a sense of depth?
- perspective
- z-index
- opacity
- transition-delay
Show answer
perspective. perspective sets the viewing distance for 3D transforms on the children.
- Which timing function keeps the speed constant from start to finish?
- ease
- ease-in-out
- linear
- cubic-bezier(0.68, -0.55, 0.27, 1.55)
Show answer
linear. linear is constant speed. The last option overshoots and bounces.
- Why is the transition property usually written on the element's normal rule rather than in its :hover rule?
- So the animation also runs when the hover ends and the element returns to normal
- Transitions in :hover rules are invalid
- It makes the page load faster
- The :hover rule cannot contain transforms
Show answer
So the animation also runs when the hover ends and the element returns to normal. On the normal state, the transition applies to changes in both directions.
Sources
- Pearson Edexcel International Advanced Subsidiary/Advanced Level in Information Technology specification (first teaching 2018), Unit 2 Topics 7 to 11
- Pearson qualifications: Edexcel International Advanced Level Information Technology (2018)
- Pearson WIT12/01 examiner report, June 2025 series
- Pearson WIT12/01 question paper, October 2021 series
Last updated 8 November 2026. Spotted a mistake? Tell us.