# Bubble Up explainer

The aim of this puzzle: Slow down the `.transition()` that makes the `bubbles` rise.

Walkthrough of the solution: The length of time it take for a `.transition()` to animate the attribute changes is set using `.duration()`. The argument of `.duration()` is in milliseconds, so `.duration(1000)` means, “the transition will take 1 second to complete”. To slow down an animation, you want to make it last longer.
If you want it to last 3.5 seconds, that would be 3500 milliseconds. You can attach `.duration(3500)` to the `.transition()` to set the time.

Sample code solution:
(Tap below to reveal)

``````function rise() {
bubbles.transition().duration(3500).attr('cy',0);
}
bubbles.on('click', rise);
``````

JavaScript Concepts: Code Block (function)

D3 Concepts: `.attr('cy',)`, `.duration()`, `.on('click',...)`, `.transition()`
Additional Code (hidden code that runs before the puzzle’s code):

``````for (let i=0; i<50; i++) {
svg.append('circle')
.attr('r',5 + Math.random()*35)
.attr('cx',Math.random()*window.innerWidth)
.attr('cy',20 + Math.random()*window.innerHeight)
.attr('fill',`rgb(\${115+pickRandom(20)},\${185+pickRandom(20)},\${225+pickRandom(20)})`)
.attr('opacity',0.8);
}

let bubbles = d3.selectAll('circle');
``````