cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!--

THIS IS ONE PART OF THREE

Check out the others here:
https://codepen.io/collection/DgggNa/

-->



<!--

Interactivity:
* Click 'add to cart' button to add carrot to cart
* Click cart icon to toggle view of cart items

*A selection of established motion principles applied to this concept
(https://material.io/guidelines/motion/material-motion.html)
- All motion design in this concept has an intentional purpose assigned to it. Each animation informs the user about something of essence.
- The 'add to cart' button knows where the user clicks and provides immediate feedback clarifying the connection between user input and the button element.
- The transformation from icon to open cart view utilise and combine a few meaningful things. The open view expands from the origin of the icon to show the user that icon and list is strongly connected. The icon stroke represents the bounds of the cart contents and bringing this meaning into the next state further associates the elements. Also, to click the bag to look inside the bag provides a fun, familiar and meaningful metaphor into the UI.
- Elements animate along curved paths with intentional directions to create meaning.
- A. The 'add to cart' motion provides clarity of what happens and guides the user's focus to the cart, but still without disrupting a continued shopping experience. The arc travel path allows the item to hit the cart from below to create a subtle success motion on its arrival. The item gains momentum along the way and transfer its energy to the cart icon in the direction it is hit.
- B. The travel path of the list items in the cart originate in the small closed state of the cart to reinforce the idea that the items live inside the cart icon.
- The cart icon serves dual functions. The handle transforming to a cross gives new meaning to an element that is already introduced. The animation is intentionally subtle because it shouldn't compete for the user's attention at that point.
- The 'total items number' is assigned with meaning in the carts closed state which it keeps throughout the transition and into the open state.
 
Critique:
* Ideally, the elements below the user's cursor don't move after interaction as the number/cross does on cart icon click. It's unexpected and unpleasant. It should feel like only one element represent the toggle interaction. In the current version, it feels like the icon consists of three separate parts, handle, number and box. This could be solved with having a unifying element below the icon, such as a solid circle, that persists throughout the transition. This would create a more pleasant and trustworthy user experience.
* I don't appreciate that the handle lines cross the box lines when transforming to a cross.

Would have been nice to add:
* Hover icon to expand box slightly, to show what will happen on click
* Morph 'total items number' to actual list items that populate the open cart state
* Calculate distance between shopping item and cart to be able to adapt the speed of shopping item animation to the distance it would travel
* A motion for closing the cart different from the opening one.
* Asynchronos transformation of the width and height of the cart bounds.
* Tweak the easing curves to create a more casual and playful feel to match the art style
* An alternative to the icon 'physics'. When the user adds an item, the car icon opens up slightly to catch the item inside of it. Would very clearly demonstrate to user how the cart element behaves.

-->

<p>Art style credits to <a href="https://www.shopify.com" target='_blank'>Shopify</a></p>
<svg id='add-to-cart' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 660 660" xmlns:xlink="http://www.w3.org/1999/xlink">
	<defs>
		<mask id='btn-mask'>
			<use fill="#FFFFFF" xlink:href="#path-1"/>
		</mask>
		<mask id='cart-content-mask'>
			<path data-anim='box-mask' fill='#FFFFFF' d="M563 71h25l1.78 24c.12 1.66-1.12 3-2.77 3h-23c-1.6 0-2.9-1.34-2.7-3l1.7-24z"/>
		</mask>
		<morph>
			<path data-path="box-open" d="M396.36 69H590v340.34H396.36z"/>
			<path data-path="line-2-open" d="M569.66 90.4l11.73-11.8"/>
			<path data-path="line-1-open" d="M581.6 90.4l-12.07-11.86"/>
		</morph>
		<g id="carrot">
			<path id="bg" fill="#FFFFFF" stroke="#DEE2EC" stroke-width="4" d="M247.72 275.4c-1.54.58-2.6 2.4-2.37 4.04 0 0 6.97 48.8 11.1 74.2 4.14 25.4 9.1 50.1 9.1 50.1.32 1.63 1.9 2.7 3.53 2.4 0 0 42.1-7.74 64.7-12.9 22.6-5.18 78.84-19.96 78.84-19.96 1.6-.43 2.6-2.06 2.2-3.68 0 0-10.27-42.12-14.38-63.64-4.1-21.5-11.9-74.08-11.9-74.08-.23-1.63-1.72-2.6-3.33-2.18 0 0-41.6 11.05-64 18.5-22.4 7.44-73.4 27.2-73.4 27.2z"/>
			<path id="carrot-head" fill="#52C1BC" d="M309.38 319.32c2.9 1.86 4.83 2.98 4.83 2.98l2.6-4.95-7.1-5.42s2.3-7.73-1.1-12.8-7.3-3.7-12.3-4.25c2.6-5.6-5.7-8.52-5.7-8.52s2.9-10.72-5.8-9.83c-8.7.88-3.3 18.35 5.6 27.67 3.3 3.5 7.6 6.93 11.5 9.84-4.7.34-10 1-14.6 2.2-11.5 3.03-21.9 20.62-15.5 25.6 8.4 6.37 9-8.07 9-8.07s12.6 5.32 12.6-5.7c3.3 1.66 5.1 2.36 10.2 0 5.2-2.35 2.9-8.44 2.9-8.44l3.3-.3z"/>
			<path id="carrot-body" fill="#FFC14C" d="M365.97 331.74c-2.8-2.46-6.2-5.5-10.37-9.3-2.38 5.46-6.17 11.1-6.17 11.1-.45.7-1.4.96-2.14.56-.8-.38-.9-1.2-.4-1.86 0 0 3.3-3.57 6.3-11.92-2-1.78-4.1-3.7-6.3-5.8-1.4-1.27-2.7-2.4-4-3.38-.6 2.5-1.3 5.32-2.4 7.73-2.6 5.92-8.5 13.32-8.5 13.32-.5.6-1.5.8-2.2.3s-.8-1.3-.3-1.9c0 0 4.2-3.8 8.2-13.1 1.4-3.2 2.2-5.9 2.8-8.1-14.9-10.5-19.8.5-27.2 10-8.4 10.7-4.1 24.4 18.1 35.8 22.3 11.3 48 .9 52.7-2.7 4.7-3.6-3.2-9.6-6.8-11.7-1.9-1.1-4.7-3.2-9.6-7.5-1.9 3.4-3.6 6-3.6 6-.4.7-1.4.9-2.1.5-.8-.4-.9-1.2-.4-1.9 0 0 1.8-2 4-6.5z"/>
		</g>
		<rect id="path-1" width="219" height="60" rx="8"/>
		<filter id="filter-2" width="106.8%" height="125%" x="-3.4%" y="-7.5%" filterUnits="objectBoundingBox">
			<feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/>
			<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
			<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0" in="shadowBlurOuter1"/>
		</filter>
		<filter id="filter-4" width="106.8%" height="125%" x="-3.4%" y="-7.5%" filterUnits="objectBoundingBox">
			<feOffset dy="3" in="SourceAlpha" result="shadowOffsetOuter1"/>
			<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
			<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0" in="shadowBlurOuter1"/>
		</filter>
	</defs>

	<g fill="none" fill-rule="evenodd">
		<path id="window" fill="#FFFFFF" stroke="#0B1238" stroke-width="5" d="M30.33 37.98c-.18-4.4 3.25-7.85 7.66-7.7 0 0 52.5 1.88 71.4 1.88 4.6 0 50.4 2.3 97.8 2.12 18.6-.08 89.4-2.74 164.9-3.52 33.9-.35 95.2 1.15 144.2 1.05 49.1-.1 105.5-1.6 105.5-1.6 4.4-.1 7.9 3.4 7.7 7.8 0 0-1.7 55.9-1.7 84.1 0 5.6 1.4 29 1.6 62.4 0 9.2-1.8 49.4-.8 99.3s.9 88.5 1.4 136.3c.4 51.1-1.8 100.1-2 137-.2 36.9 1.3 65.1 1.3 65.1.2 4.4-3.2 7.8-7.6 7.6 0 0-51.1-2.4-76.6-2.4-7.8 0-58.6 1.3-125.2 1.7-21.6.1-44.6-2.2-99.2-2-37.1.1-102.6 3-174 3.9-71.5.9-109.1-.4-109.1-.4-4.4-.1-7.8-3.8-7.6-8.2 0 0 2.3-46.6 2.3-69.7 0-6.7-1.9-53.2-2.2-115.7-.2-29.1-.1-115.4-.2-201.4 0-33.1 1.13-111.7 1.1-144.5 0-32.7-1-52.7-1-52.7z"/>
		<path id="bg" fill="#F4F6F8" d="M306.55 582.56c-149.02-29.03-219-231.42-180.63-281.86 38.37-50.44 86.73-113.1 196.53-113.1s207.7 9.92 216.62 75.47C548 328.63 549.8 430 512.3 485.57c-38.75 52.66-56.72 126.03-205.75 97z"/>
		<path id="divivder" stroke="#E8EAF1" stroke-width="5" d="M50 130h560" stroke-linecap="round"/>
		<g id="btn" transform="translate(225.5 448.375)">
			<g id="bg">
				<use data-anim='shadow' fill="black" filter="url(#filter-2)" xlink:href="#path-1"/>
				<use data-anim='btn-bg' fill="#52C1BC" xlink:href="#path-1"/>
			</g>
			<g mask='url(#btn-mask)'>
				<circle id="ripple" data-anim='ripple' class='hidden' cx="109.5" cy="30" r="10" fill="#45A6A1"/>
			</g>
			<path id="label" fill="#FFFFFF" d="M39.96 33.74h-4l-.7 2.26h-3.1l4.43-12.1h2.7L43.8 36h-3.13l-.7-2.26zm-3.3-2.25h2.6l-1.3-4.2-1.3 4.2zM48.94 36V23.9h3.9c1.06 0 2.02.26 2.87.74.9.48 1.6 1.17 2 2.05.5.8.8 1.8.8 2.9v.5c0 1.1-.2 2.1-.7 3-.4.8-1.1 1.5-2 2-.8.5-1.8.7-2.8.7h-4zm2.9-9.84v7.6h1.03c.83 0 1.47-.3 1.92-.9.4-.6.6-1.47.6-2.65v-.5c0-1.1-.2-2-.7-2.6-.5-.6-1.1-.9-2-.9h-1zM64.18 36V23.9h3.9c1.06 0 2.02.26 2.87.74.86.48 1.52 1.17 2 2.05.48.8.72 1.8.73 2.9v.5c0 1.1-.24 2.1-.7 3-.47.8-1.13 1.5-1.98 2-.86.5-1.8.7-2.85.7h-3.98zm2.9-9.84v7.6h1.03c.9 0 1.5-.3 2-.9.5-.6.7-1.47.7-2.65v-.5c0-1.1-.2-2-.6-2.6-.4-.6-1.1-.9-1.9-.9h-1zm29.8 0h-3.6V36h-2.93v-9.84H86.8V23.9h10.1v2.26zm15.5 4.05c0 1.2-.22 2.3-.66 3.2-.43.9-1.05 1.6-1.86 2.1-.8.5-1.72.8-2.75.8s-1.9-.2-2.7-.7c-.8-.5-1.4-1.1-1.8-2-.4-.9-.7-1.9-.7-3V30c0-1.2.2-2.25.7-3.16.5-.9 1.1-1.6 1.9-2.1.9-.5 1.8-.72 2.8-.72 1 0 1.9.26 2.8.75.8.5 1.4 1.2 1.9 2.1.5.9.7 1.93.7 3.1v.55zm-2.97-.5c0-1.2-.2-2.1-.6-2.7-.4-.6-.9-.9-1.7-.9-1.4 0-2.2 1.1-2.3 3.3v.9c0 1.2.2 2.1.6 2.8.4.7 1 1 1.8 1s1.3-.3 1.7-.9c.4-.6.6-1.5.6-2.7V30zm27 2.2c0 .9-.2 1.6-.7 2.3-.4.7-1 1.2-1.7 1.5-.7.4-1.6.6-2.5.6-1.6 0-2.8-.5-3.7-1.5-.9-1-1.3-2.5-1.3-4.3v-.6c0-1.2.2-2.2.7-3.1.4-.9 1-1.6 1.8-2 .8-.5 1.7-.7 2.7-.7 1.5 0 2.7.4 3.5 1.2.9.8 1.4 1.9 1.5 3.2h-2.9c0-.7-.2-1.2-.5-1.6-.3-.3-.8-.4-1.6-.4-.7 0-1.2.3-1.6.8-.3.6-.5 1.4-.5 2.6v.9c0 1.3.2 2.2.5 2.8.3.6.9.8 1.7.8.7 0 1.2-.1 1.6-.5.4-.3.6-.8.6-1.5h2.9zm12.5 1.9h-4l-.7 2.3h-3.1l4.4-12.1h2.8l4.4 12h-3.1l-.7-2.2zm-3.3-2.2h2.6l-1.3-4.2-1.3 4.2zm16.8.3h-1.6V36h-2.9V23.9h4.8c1.5 0 2.6.33 3.4.97.8.64 1.2 1.53 1.2 2.7 0 .84-.1 1.53-.5 2.1-.3.54-.9 1-1.6 1.33l2.5 4.88V36h-3.1l-2.1-4.27zm-1.6-2.2h1.9c.6 0 1-.1 1.3-.4.3-.3.4-.7.4-1.2s-.1-.9-.4-1.2c-.3-.3-.7-.4-1.2-.4H161v3.3zm21.5-3.3h-3.6V36h-2.9v-9.84h-3.5V23.9h10.1v2.26z"/>
		</g>
		<use id='buy-carrot-2' data-anim='carrot' xlink:href="#carrot" />
		<use id='buy-carrot-1' xlink:href="#carrot" />
		<g data-anim="icon">
			<g id="box">
				<path data-anim="box" fill="#FFFFFF" d="M563 71h25l1.78 24c.12 1.66-1.12 3-2.77 3h-23c-1.6 0-2.9-1.34-2.7-3l1.7-24z"/>
			</g>
		</g>
		<g data-anim="cart-content" mask='url(#cart-content-mask)'>
			<g data-anim="cart-item" >
				<g id="btn-checkout" transform="translate(430.5 359.375)">
					<rect id="bg" width="123.31" height="33.78" x=".94" y=".11" fill="#FFC14C" rx="6.4"/>
					<path id="label" fill="#FFFFFF" d="M22.3 18.73c-.03.67-.2 1.26-.55 1.78-.33.6-.8 1-1.4 1.2-.6.3-1.28.5-2.05.5-1.27 0-2.27-.4-3-1.2s-1.1-2-1.1-3.5V17c0-.94.17-1.77.5-2.48.33-.7.8-1.26 1.42-1.65.62-.38 1.34-.58 2.15-.58 1.18 0 2.12.3 2.83.9.72.6 1.12 1.4 1.22 2.5H20c-.02-.6-.17-1-.45-1.3-.28-.3-.7-.4-1.28-.4-.58 0-1 .2-1.27.6s-.4 1.1-.43 2v.7c0 1 .13 1.7.4 2.2.25.4.7.6 1.33.6.54 0 .95-.1 1.23-.4s.43-.7.45-1.2h2.32zM34.88 22h-2.32v-4.04h-3.43V22H26.8v-9.67h2.33v3.84h3.43v-3.84h2.32V22zm10.87-4.1H42.1v2.3h4.32V22h-6.66v-9.67h6.67v1.8H42.1v2.04h3.65v1.73zm12.84.83c-.1.67-.3 1.26-.6 1.78-.4.6-.8 1-1.4 1.2-.6.3-1.3.5-2.1.5-1.3 0-2.3-.4-3-1.2s-1.1-2-1.1-3.5V17c0-.94.1-1.77.5-2.48.3-.7.8-1.26 1.4-1.65.6-.38 1.3-.58 2.1-.58 1.2 0 2.1.3 2.8.9.7.6 1.1 1.4 1.2 2.5h-2.2c0-.6-.2-1-.5-1.3-.3-.3-.7-.4-1.3-.4-.6 0-1 .2-1.3.6-.2.4-.4 1.1-.4 2v.7c0 1 .1 1.7.4 2.2.3.4.7.6 1.3.6.5 0 .9-.1 1.2-.4s.4-.7.4-1.2h2.3zm7.7-.33l-1 1.05V22H63v-9.67h2.3v4.26l.8-1.3 2.1-3.1h2.9l-3.27 4.3 3.3 5.4H68.4l-2.05-3.6zm16.8-1.04c0 .95-.2 1.78-.6 2.5-.4.73-.9 1.3-1.5 1.7-.7.38-1.4.57-2.2.57-.8 0-1.6-.2-2.2-.56-.6-.38-1.1-.92-1.5-1.63-.4-.7-.6-1.5-.6-2.42v-.55c0-.94.2-1.78.5-2.5.3-.73.8-1.3 1.5-1.68.6-.4 1.3-.6 2.2-.6.8 0 1.5.2 2.2.5.6.4 1.1.9 1.5 1.6.3.7.5 1.5.5 2.4v.4zm-2.4-.4c0-.96-.2-1.7-.5-2.2-.3-.5-.8-.74-1.4-.74-1.2 0-1.8.88-1.9 2.63v.7c0 .96.1 1.7.4 2.2.3.5.8.76 1.4.76.6 0 1-.2 1.4-.7.3-.5.4-1.2.4-2.1V17zm14.5-4.63v6.33c0 .72-.2 1.34-.5 1.86-.3.53-.8.93-1.3 1.2-.6.28-1.3.4-2.1.4-1.2 0-2.1-.3-2.8-.9-.7-.6-1.1-1.45-1.1-2.5v-6.4H90v6.43c0 1.06.5 1.6 1.46 1.6.5 0 .85-.14 1.1-.4.24-.27.37-.7.37-1.3v-6.32h2.34zm12.4 1.8h-2.9V22h-2.4v-7.87h-2.8v-1.8h8.1v1.8z"/>
				</g>
			</g>
			<g data-anim="cart-item" >
				<path id="bg" fill="#F4F6F8" d="M403 307c0-4.42 3.58-8 8-8h177v46H411c-4.4 0-8-3.6-8-8v-30z"/>
				<g id="coins">
					<g data-anim="coin">
						<path id="edge" fill="#FFC14C" d="M464.93 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="face" fill="#FFE77F" d="M462.93 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="$" fill="#FFC14C" d="M476.16 314.45v1.08c.86.1 1.63.27 2.32.54.37.15.75.74.38 1.83-.38 1.08-1.25.98-1.52.85-.5-.26-1.02-.4-1.52-.4-.47 0-.85.12-1.14.33-.3.22-.45.46-.45.73 0 .3.12.5.35.8.24.2.55.4.93.6l1.1.4c1.3.4 2.1 1 2.7 1.6.6.6.8 1.4.8 2.4 0 .6 0 1.2-.2 1.6-.1.5-.3.9-.6 1.3s-.7.7-1.2 1c-.5.3-1.1.5-1.8.8v1.1s.2 1.1-.8 1.1-.9-1.1-.9-1.1v-1.1c-.3 0-.7 0-1.2-.1l-1.2-.3c-.4-.12-.8-.3-1.2-.5-.2-.1-.4-.2-.5-.3-.1-.1-.5-.9-.1-1.9.5-1 1.6-.8 1.8-.7 1 .7 1.9 1.1 2.8 1.1.5 0 .9-.1 1.2-.34.4-.3.5-.6.5-1 0-.53-.4-.93-1.2-1.2l-1-.32c-.6-.2-1.1-.4-1.6-.62-.4-.22-.8-.5-1-.8-.3-.3-.5-.65-.6-1.04-.2-.4-.2-.86-.2-1.36 0-.54.06-1.05.2-1.55s.4-.93.7-1.32c.3-.4.7-.7 1.2-1 .4-.23 1-.4 1.6-.5v-1.04s-.1-1.2.88-1.2.84 1.16.84 1.16z"/>
					</g>
					<g data-anim="coin">
						<path id="edge" fill="#FFC14C" d="M482.43 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="face" fill="#FFE77F" d="M480.43 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="$" fill="#FFC14C" d="M493.66 314.45v1.08c.86.1 1.63.27 2.32.54.37.15.75.74.38 1.83-.38 1.08-1.25.98-1.52.85-.5-.26-1.02-.4-1.52-.4-.47 0-.85.12-1.14.33-.3.22-.45.46-.45.73 0 .3.12.5.35.8.24.2.55.4.93.6l1.1.4c1.3.4 2.1 1 2.7 1.6.6.6.8 1.4.8 2.4 0 .6 0 1.2-.2 1.6-.1.5-.3.9-.6 1.3s-.7.7-1.2 1c-.5.3-1.1.5-1.8.8v1.1s.2 1.1-.8 1.1-.9-1.1-.9-1.1v-1.1c-.3 0-.7 0-1.2-.1l-1.2-.3c-.4-.12-.8-.3-1.2-.5-.2-.1-.4-.2-.5-.3-.1-.1-.5-.9-.1-1.9.5-1 1.6-.8 1.8-.7 1 .7 1.9 1.1 2.8 1.1.5 0 .9-.1 1.2-.34.4-.3.5-.6.5-1 0-.53-.4-.93-1.2-1.2l-1-.32c-.6-.2-1.1-.4-1.6-.62-.4-.22-.8-.5-1-.8-.3-.3-.5-.65-.6-1.04-.2-.4-.2-.86-.2-1.36 0-.54.06-1.05.2-1.55s.4-.93.7-1.32c.3-.4.7-.7 1.2-1 .4-.23 1-.4 1.6-.5v-1.04s-.1-1.2.88-1.2.84 1.16.84 1.16z"/>
					</g>
					<g data-anim="coin">
						<path id="edge" fill="#FFC14C" d="M499.93 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="face" fill="#FFE77F" d="M497.93 318.93s.95-4.1 3.44-6.15c1.24-1.03 6-3.5 10.78-2.8 2.96.45 5.5 2.63 7.44 5.4 1.9 2.78 2.3 5.62 2.5 8.1.3 3.78-3.1 7.02-4.8 9.04-1 1.13-7 3.04-12 1.4-5.1-1.65-7.1-5.07-8-10.43l.5-4.6z"/>
						<path id="$" fill="#FFC14C" d="M511.16 314.45v1.08c.86.1 1.63.27 2.32.54.37.15.75.74.38 1.83-.38 1.08-1.25.98-1.52.85-.5-.26-1.02-.4-1.52-.4-.47 0-.85.12-1.14.33-.3.22-.45.46-.45.73 0 .3.12.5.35.8.24.2.55.4.93.6l1.1.4c1.3.4 2.1 1 2.7 1.6.6.6.8 1.4.8 2.4 0 .6 0 1.2-.2 1.6-.1.5-.3.9-.6 1.3s-.7.7-1.2 1c-.5.3-1.1.5-1.8.8v1.1s.2 1.1-.8 1.1-.9-1.1-.9-1.1v-1.1c-.3 0-.7 0-1.2-.1l-1.2-.3c-.4-.12-.8-.3-1.2-.5-.2-.1-.4-.2-.5-.3-.1-.1-.5-.9-.1-1.9.5-1 1.6-.8 1.8-.7 1 .7 1.9 1.1 2.8 1.1.5 0 .9-.1 1.2-.34.4-.3.5-.6.5-1 0-.53-.4-.93-1.2-1.2l-1-.32c-.6-.2-1.1-.4-1.6-.62-.4-.22-.8-.5-1-.8-.3-.3-.5-.65-.6-1.04-.2-.4-.2-.86-.2-1.36 0-.54.06-1.05.2-1.55s.4-.93.7-1.32c.3-.4.7-.7 1.2-1 .4-.23 1-.4 1.6-.5v-1.04s-.1-1.2.88-1.2.84 1.16.84 1.16z"/>
					</g>
				</g>
			</g>
			<g data-anim="cart-item" >
				<path id="bg" fill="#F4F6F8" d="M403 257c0-4.42 3.58-8 8-8h177v46H411c-4.4 0-8-3.6-8-8v-30z"/>
				<g data-anim="cart-item-carrot">
					<path id="Combined-Shape" fill="#52C1BC" d="M424.28 270.7c.75.5 1.26.78 1.26.78l.66-1.3-1.87-1.4s.6-2.03-.28-3.36c-.9-1.33-1.92-.97-3.23-1.1.66-1.48-1.5-2.24-1.5-2.24s.76-2.8-1.52-2.58c-2.28.23-.87 4.8 1.45 7.25.87.9 1.97 1.8 3 2.57-1.23.1-2.62.26-3.82.58-3.02.8-5.74 5.4-4.06 6.7 2.2 1.67 2.33-2.1 2.33-2.1s3.3 1.38 3.3-1.5c.85.43 1.3.6 2.65 0 1.35-.62.77-2.22.77-2.22l.86-.08z"/>
					<path id="Combined-Shape" fill="#FFC14C" d="M439.1 273.96c-.74-.65-1.63-1.44-2.72-2.44-.63 1.43-1.62 2.9-1.62 2.9-.12.2-.36.26-.56.16-.2-.1-.23-.32-.1-.5 0 0 .87-.93 1.67-3.1-.5-.48-1.07-.98-1.66-1.53-.3-.33-.7-.63-1-.9-.1.67-.3 1.4-.6 2.04-.7 1.5-2.2 3.4-2.2 3.4-.1.1-.4.2-.5.1-.2-.1-.2-.4 0-.5 0 0 1.1-1 2.2-3.5.4-.9.6-1.6.8-2.1-3.9-2.8-5.1.1-7.1 2.6-2.2 2.8-1 6.4 4.8 9.3 5.9 3 12.6.2 13.8-.7 1.3-.9-.8-2.5-1.8-3-.5-.3-1.2-.9-2.5-2l-.9 1.6c-.1.2-.4.2-.6.1-.2-.1-.2-.3-.1-.5 0 0 .5-.5 1.1-1.7z"/>
				</g>
				<g data-anim="cart-item-info" stroke="#989BAF" stroke-linecap="round" stroke-linejoin="round">
					<path id="Path-4" d="M456.73 280.77s7.25-.28 18.28-.2c11.1.08 17.2.4 20.3.48 3.1.1 4.9.52 16.5 0 11.6-.53 6.5-.67 11.9-.74 5.4 0 9.2.4 13.3.5l11.6-.4"/>
					<path id="Path-2" d="M456.74 271.64s2.98 1.62 6.8-.9c3.84-2.5 7.67-8.68 5.58-8.68-2.54 0-3 3.38-3 3.38s-.98 5.9 2.6 6.25c8.43.8 9.16-8.8 12.9-7.8 3.7 1-1.47 5.7 1.8 7.1 3.25 1.3 5.87-5.5 8.4-5.2 2.53.2-.1 2.9 2.15 3.4 2.25.4 2.72-1.9 4.85-1.6 2.14.3-.54 2.3 2.77 1.9 3.3-.4 8.2-1.7 8.2-1.7"/>
				</g>
			</g>
			<g data-anim="cart-item">
				<path id="bg" fill="#F4F6F8" d="M403 207c0-4.42 3.58-8 8-8h177v46H411c-4.4 0-8-3.6-8-8v-30z"/>
				<g data-anim="cart-item-carrot">
					<path id="Combined-Shape" fill="#52C1BC" d="M424.28 220.7c.75.5 1.26.78 1.26.78l.66-1.3-1.87-1.4s.6-2.03-.28-3.36c-.9-1.33-1.92-.97-3.23-1.1.66-1.48-1.5-2.24-1.5-2.24s.76-2.8-1.52-2.58c-2.28.23-.87 4.8 1.45 7.25.87.9 1.97 1.8 3 2.57-1.23.1-2.62.26-3.82.58-3.02.8-5.74 5.4-4.06 6.7 2.2 1.67 2.33-2.1 2.33-2.1s3.3 1.38 3.3-1.5c.85.43 1.3.6 2.65 0 1.35-.62.77-2.22.77-2.22l.86-.08z"/>
					<path id="Combined-Shape" fill="#FFC14C" d="M439.1 223.96c-.74-.65-1.63-1.44-2.72-2.44-.63 1.43-1.62 2.9-1.62 2.9-.12.2-.36.26-.56.16-.2-.1-.23-.32-.1-.5 0 0 .87-.93 1.67-3.1-.5-.48-1.07-.98-1.66-1.53-.3-.33-.7-.63-1-.9-.1.67-.3 1.4-.6 2.04-.7 1.5-2.2 3.4-2.2 3.4-.1.1-.4.2-.5.1-.2-.1-.2-.4 0-.5 0 0 1.1-1 2.2-3.5.4-.9.6-1.6.8-2.1-3.9-2.8-5.1.1-7.1 2.6-2.2 2.8-1 6.4 4.8 9.3 5.9 3 12.6.2 13.8-.7 1.3-.9-.8-2.5-1.8-3-.5-.3-1.2-.9-2.5-2l-.9 1.6c-.1.2-.4.2-.6.1-.2-.1-.2-.3-.1-.5 0 0 .5-.5 1.1-1.7z"/>
				</g>
				<g data-anim="cart-item-info" stroke="#989BAF" stroke-linecap="round" stroke-linejoin="round">
					<path id="Path-4" d="M456.73 230.77s7.25-.28 18.28-.2c11.1.08 17.2.4 20.3.48 3.1.1 4.9.52 16.5 0 11.6-.53 6.5-.67 11.9-.74 5.4 0 9.2.4 13.3.5l11.6-.4"/>
					<path id="Path-2" d="M456.74 221.64s2.98 1.62 6.8-.9c3.84-2.5 7.67-8.68 5.58-8.68-2.54 0-3 3.38-3 3.38s-.98 5.9 2.6 6.25c8.43.8 9.16-8.8 12.9-7.8 3.7 1-1.47 5.7 1.8 7.1 3.25 1.3 5.87-5.5 8.4-5.2 2.53.2-.1 2.9 2.15 3.4 2.25.4 2.72-1.9 4.85-1.6 2.14.3-.54 2.3 2.77 1.9 3.3-.4 8.2-1.7 8.2-1.7"/>
				</g>
			</g>
			<g data-anim="cart-item">
				<path id="bg" fill="#F4F6F8" d="M403 157c0-4.42 3.58-8 8-8h177v46H411c-4.4 0-8-3.6-8-8v-30z"/>
				<g data-anim="cart-item-carrot">
					<path id="Combined-Shape" fill="#52C1BC" d="M424.28 170.7c.75.5 1.26.78 1.26.78l.66-1.3-1.87-1.4s.6-2.03-.28-3.36c-.9-1.33-1.92-.97-3.23-1.1.66-1.48-1.5-2.24-1.5-2.24s.76-2.8-1.52-2.58c-2.28.23-.87 4.8 1.45 7.25.87.9 1.97 1.8 3 2.57-1.23.1-2.62.26-3.82.58-3.02.8-5.74 5.4-4.06 6.7 2.2 1.67 2.33-2.1 2.33-2.1s3.3 1.38 3.3-1.5c.85.43 1.3.6 2.65 0 1.35-.62.77-2.22.77-2.22l.86-.08z"/>
					<path id="Combined-Shape" fill="#FFC14C" d="M439.1 173.96c-.74-.65-1.63-1.44-2.72-2.44-.63 1.43-1.62 2.9-1.62 2.9-.12.2-.36.26-.56.16-.2-.1-.23-.32-.1-.5 0 0 .87-.93 1.67-3.1-.5-.48-1.07-.98-1.66-1.53-.3-.33-.7-.63-1-.9-.1.67-.3 1.4-.6 2.04-.7 1.5-2.2 3.4-2.2 3.4-.1.1-.4.2-.5.1-.2-.1-.2-.4 0-.5 0 0 1.1-1 2.2-3.5.4-.9.6-1.6.8-2.1-3.9-2.8-5.1.1-7.1 2.6-2.2 2.8-1 6.4 4.8 9.3 5.9 3 12.6.2 13.8-.7 1.3-.9-.8-2.5-1.8-3-.5-.3-1.2-.9-2.5-2l-.9 1.6c-.1.2-.4.2-.6.1-.2-.1-.2-.3-.1-.5 0 0 .5-.5 1.1-1.7z"/>
				</g>
				<g data-anim="cart-item-info" stroke="#989BAF" stroke-linecap="round" stroke-linejoin="round">
					<path id="Path-4" d="M456.73 180.77s7.25-.28 18.28-.2c11.1.08 17.2.4 20.3.48 3.1.1 4.9.52 16.5 0 11.6-.53 6.5-.67 11.9-.74 5.4 0 9.2.4 13.3.5l11.6-.4"/>
					<path id="Path-2" d="M456.74 171.64s2.98 1.62 6.8-.9c3.84-2.5 7.67-8.68 5.58-8.68-2.54 0-3 3.38-3 3.38s-.98 5.9 2.6 6.25c8.43.8 9.16-8.8 12.9-7.8 3.7 1-1.47 5.7 1.8 7.1 3.25 1.3 5.87-5.5 8.4-5.2 2.53.2-.1 2.9 2.15 3.4 2.25.4 2.72-1.9 4.85-1.6 2.14.3-.54 2.3 2.77 1.9 3.3-.4 8.2-1.7 8.2-1.7"/>
				</g>
			</g>
			<g data-anim="cart-item">
				<path id="bg" fill="#F4F6F8" d="M403 107c0-4.42 3.58-8 8-8h177v46H411c-4.4 0-8-3.6-8-8v-30z"/>
				<path data-anim="total-items" fill="#989BAF" d="M422.62 121.05h-2.88V129h-1.6v-7.95h-2.85v-1.3h7.3v1.3zm8.6 3.57c0 .9-.17 1.7-.48 2.38-.32.7-.76 1.2-1.35 1.58-.6.36-1.3.55-2.1.55s-1.4-.2-2-.55c-.6-.37-1.1-.9-1.4-1.57-.3-.6-.5-1.4-.5-2.3v-.5c0-.9.1-1.7.4-2.4.3-.7.8-1.2 1.3-1.5.6-.3 1.2-.5 2-.5s1.4.2 2 .6c.6.4 1 .9 1.3 1.6.3.7.5 1.5.5 2.4v.6zm-1.62-.48c0-1.03-.2-1.8-.58-2.36-.4-.54-.94-.82-1.65-.82-.7 0-1.24.28-1.63.82-.4.54-.6 1.3-.6 2.3v.54c0 1.02.2 1.8.6 2.36.4.55.94.83 1.64.83.72 0 1.26-.2 1.65-.8.38-.5.57-1.3.57-2.3v-.5zm9.88-3.1h-2.88V129H435v-7.95h-2.85v-1.3h7.33v1.3zm6.4 5.8h-3.6l-.74 2.16h-1.67l3.5-9.24h1.43l3.5 9.24h-1.68l-.75-2.15zm-3.14-1.3h2.68l-1.34-3.82-1.34 3.83zm8.2 2.18h4.2V129h-5.8v-9.24h1.6v7.96zM461.3 129h-1.6v-9.24h1.6V129zm8.67-7.95h-2.88V129h-1.6v-7.95h-2.9v-1.3h7.3v1.3zm6.62 3.82h-3.8v2.85h4.4V129h-6.1v-9.24h6v1.3h-4.4v2.54h3.8v1.27zm4-5.1l2.7 7.07 2.6-7.08h2.1V129h-1.6v-3.05l.1-4.07-2.8 7.12h-1.2l-2.8-7.12.1 4.07V129h-1.6v-9.24h2.1zm14.1 6.85c0-.4-.2-.72-.5-.94-.3-.22-.8-.44-1.6-.67-.8-.2-1.4-.4-1.8-.7-.9-.5-1.3-1.2-1.3-2 0-.7.3-1.3.9-1.8.6-.5 1.4-.7 2.3-.7.6 0 1.2.2 1.7.4s.9.6 1.2 1c.2.5.4.9.4 1.5h-1.6c0-.5-.2-.9-.5-1.1-.3-.3-.8-.4-1.3-.4-.6 0-1 .1-1.3.3-.3.2-.46.6-.46 1s.15.6.46.9c.3.2.86.5 1.6.7.7.2 1.3.5 1.7.8.4.3.74.6.94 1 .2.34.3.75.3 1.23 0 .8-.3 1.4-.9 1.8-.6.5-1.4.7-2.4.7-.63 0-1.3-.1-1.8-.4-.56-.2-1-.6-1.3-1-.3-.4-.47-.9-.47-1.5h1.6c0 .6.2 1 .5 1.3.3.3.8.46 1.5.46.5 0 .9-.1 1.2-.36s.4-.5.4-.9zm3.8.75c.3 0 .5.1.6.25.1.16.2.37.2.6 0 .25-.1.45-.3.6-.2.17-.4.25-.7.25s-.5-.08-.7-.24c-.2-.15-.3-.35-.3-.6 0-.24.1-.45.2-.6.1-.17.3-.26.6-.26zm0-5.38c.3 0 .5 0 .6.2.1.1.2.3.2.6s-.1.4-.3.6c-.2.1-.4.2-.7.2s-.5-.1-.7-.3c-.2-.2-.3-.4-.3-.6 0-.3.1-.5.2-.6.1-.2.3-.3.6-.3z"/>
			</g>
		</g>
		<g data-anim="line-group" stroke="#989BAF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
			<path data-anim="line-2" d="M569.66 70.4c0-10.52 2.37-9.6 6.94-9.6"/>
			<path data-anim="line-1" d="M581.6 70.4c0-10.52-2.38-9.6-6.94-9.6"/>
		</g>
		<path data-anim="box-stroke" fill="none" stroke="#989BAF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" d="M563 71h25l1.78 24c.12 1.66-1.12 3-2.77 3h-23c-1.6 0-2.9-1.34-2.7-3l1.7-24z"/>
		<g data-anim="num-group" fill="#999CAF" stroke='none'>
			<path data-anim="num-2" d="M579.63 90h-8.44v-1.83l3.8-4.07c.9-1.1 1.4-2 1.4-2.6 0-.6-.1-.98-.4-1.2-.3-.3-.6-.4-1-.4s-.8.12-1 .5-.4.8-.4 1.34h-2.8c0-.75.2-1.44.5-2.07.3-.6.8-1.1 1.5-1.47.6-.34 1.4-.52 2.2-.52 1.3 0 2.3.3 3 .9.7.6 1 1.5 1 2.6 0 .5-.1.96-.3 1.4-.2.46-.5.94-.9 1.4-.4.5-1 1.2-1.8 2l-1.6 1.8h4.7V90z"/>
			<path data-anim="num-3" class='hidden' d="M573.75 82.8h1.32c1.04 0 1.57-.53 1.57-1.55 0-.4-.13-.72-.38-.97-.25-.26-.6-.38-1.05-.38-.3 0-.6.1-.9.32-.2.22-.4.5-.4.8h-2.8c0-.63.2-1.2.5-1.7s.9-.88 1.5-1.16c.7-.28 1.3-.42 2.1-.42 1.4 0 2.4.3 3.2.92.8.62 1.2 1.46 1.2 2.53 0 .5-.1 1-.4 1.4-.3.4-.8.8-1.4 1.1.7.2 1.2.6 1.5 1 .4.4.6 1 .6 1.7 0 1.1-.4 1.9-1.2 2.6-.8.6-1.9.9-3.2.9-.8 0-1.5-.2-2.2-.5-.7-.3-1.2-.7-1.5-1.3-.3-.5-.5-1.1-.5-1.8h2.8c0 .4.2.7.4.9.3.2.7.4 1.1.4.5 0 .9-.2 1.2-.4.3-.3.4-.7.4-1.1 0-.6-.1-1-.4-1.3-.3-.2-.7-.4-1.2-.4H574v-2z"/>
		</g>
		<rect class='clickable' data-click='btn' fill="rgba(255,255,255,0.01)" width="219" height="60" x="225" y="448" rx="8"/>
		<path class='clickable' data-click='icon' fill="rgba(255,255,255,0.01)" d="M549 47h52v52h-52z" opacity="0.01" transform='translate(0 7)'/>
		<path id="Oval-3" fill="#7682CE" d="M55.95 56.76c4.42 0 4.66-3.12 4.66-7.53C60.6 44.8 58.5 42 54 42s-8 3.58-8 8 5.53 6.76 9.95 6.76z"/>
		<path id="Oval-3-Copy" fill="#7682CE" d="M75.94 56.33c-4.42 0-6.56-2.7-6.56-7.1 0-4.42 3.08-6.93 7.5-6.93S84 45.58 84 50s-3.64 6.33-8.06 6.33z"/>
		<path id="Oval-3-Copy-2" fill="#7682CE" d="M100.68 56.52c-4.42 0-7.38-2.53-7.38-6.95s2.55-7.27 6.97-7.27c4.4 0 6.36 3.3 6.36 7.73 0 4.42-1.53 6.5-5.95 6.5z"/>
	</g>
</svg>

            
          
!
            
              body {
	background:#52C1BC;
}
p { 
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	z-index: -1;
}

p, a {
	font-size: small;
	font-family: sans-serif;
	color: rgba(255,255,255,0.5);
}

#add-to-cart {
	position: absolute;
	top:50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 600px;
}

.hidden {
	visibility: hidden;
}

.clickable {
	cursor: pointer;
	opacity: 0.01;
}
            
          
!
            
              // Animatables
var shadow = document.querySelector('[data-anim=shadow]'),
	rpl = document.querySelector('[data-anim=ripple]'),
	carrot = document.querySelector('[data-anim=carrot]'),
	icon = document.querySelector('[data-anim=icon]'),
	box = document.querySelector('[data-anim=box]'),
	boxStroke = document.querySelector('[data-anim=box-stroke]'),
	boxMask = document.querySelector('[data-anim=box-mask]'),
	lineGroup = document.querySelector('[data-anim=line-group]'),
	line1 = document.querySelector('[data-anim=line-1]'),
	line2 = document.querySelector('[data-anim=line-2]'),
	cartContent = document.querySelector('[data-anim=cart-content]'),
	cartItems = document.querySelectorAll('[data-anim=cart-item]'),
	cartItemsCarrot = document.querySelectorAll('[data-anim=cart-item-carrot]'),
	cartItemsInfo = document.querySelectorAll('[data-anim=cart-item-info]'),
	coins = document.querySelectorAll('[data-anim=coin]'),
	totItems = document.querySelector('[data-anim=total-items]'),
	numGroup = document.querySelector('[data-anim=num-group]'),
	num2 = document.querySelector('[data-anim=num-2]'),
	num3 = document.querySelector('[data-anim=num-3]');

// Paths
var boxOpen = document.querySelector('[data-path=box-open]'),
	line1Open = document.querySelector('[data-path=line-1-open]'),
	line2Open = document.querySelector('[data-path=line-2-open]');

// Interactive
var iconArea = document.querySelector('[data-click=icon]'),
	btnArea = document.querySelector('[data-click=btn]');

// Storage
var clickOrig,
	itemDest;

// Flags
var isOpen = false;

// Listeners
iconArea.addEventListener('click', iconHandler);
btnArea.addEventListener('click', btnHandler);

// Handlers
function iconHandler(e) {
	isOpen ? toggleCartTl.reverse() : toggleCartTl.play();
	isOpen = !isOpen;
}

function btnHandler(e) {
	var delay = 0.4;
	isOpen ? iconHandler() : delay = 0;
	getAddToCartTl( getClickCoords(e) ).delay(delay).play();
}

// Timelines
function getAddToCartTl(coords) {

	var addToCartTl = new TimelineMax({ paused:true }),
		btnTl = new TimelineMax({ paused:true }),
		itemTl = new TimelineMax({ paused:true }),
		iconTl = new TimelineMax({ paused:true });

	addToCartTl
		.add( btnTl.play(), 0 )
		.add( itemTl.play(), 0 )
		.add( iconTl.play(), 0.5);

	btnTl
		.to(shadow, 0, { autoAlpha:0 }, 0)
		.to(shadow, 0.5, { autoAlpha:1 }, 0)
		.to(ripple, 0, { x: coords.x, y:coords.y }, 0)
		.fromTo(ripple, 0.5, { autoAlpha:0.5, scale: 0,}, { autoAlpha:0, scale: 20, transformOrigin: 'center' }, 0);

	itemTl
		.fromTo(carrot, 0.5, { x: 0 }, { x: 242, ease: Power1.easeInOut },0)
		.fromTo(carrot, 0.5, { y: 0 }, { y:-240, ease: Back.easeIn },0)
		.fromTo(carrot, 0.5, { rotation:0, scale: 1 }, { rotation:-80, scale:0.25, transformOrigin: 'center', ease: Power1.easeInOut },0)
		.fromTo(carrot, 0.05, { autoAlpha:1 }, { autoAlpha:0 }, 0.45);

	iconTl
		.fromTo(num2, 0.15, { y: 0, autoAlpha:1 }, { y: -10, autoAlpha:0 }, 0)
		.fromTo(num3, 0.15, { y: 15, autoAlpha:0 }, { y: 0, autoAlpha:1 }, 0)
		.fromTo([icon, numGroup, lineGroup, boxStroke], 0.15, { y:0 }, { y: -5, ease: Power1.easeOut, repeat:1, yoyo:true }, 0);

	return addToCartTl;
}

var toggleCartTl = new TimelineMax({paused:true}),
	linesTl = new TimelineMax({paused:true}),
	boxTl = new TimelineMax({paused:true}),
	numTl = new TimelineMax({paused:true}),
	contentTl = new TimelineMax({paused:true}),
	toggleDur = 0.4,
	staggerDur = toggleDur*0.05,
	startY = [-300,-250,-200,-150,-100,-50].reverse();

toggleCartTl
	.add( linesTl.play(), 0 )
	.add( boxTl.play(), 0 )
	.add( numTl.play(), 0 )
	.add( contentTl.play(), 0);

linesTl
	.fromTo(line1, toggleDur, { morphSVG:line1}, { morphSVG:line1Open, ease: Power3.easeInOut }, 0)
	.fromTo(line2, toggleDur, { morphSVG:line2}, { morphSVG:line2Open, ease: Power4.easeInOut }, 0);

boxTl
	.fromTo(box, toggleDur, { morphSVG:box}, { morphSVG:boxOpen, ease: Power3.easeInOut }, 0)
	.fromTo(boxStroke, toggleDur, { strokeWidth:3, autoAlpha:1, morphSVG:box}, { strokeWidth:2, autoAlpha:0.5, morphSVG:boxOpen, ease: Power3.easeInOut }, 0)
	.fromTo(boxMask, toggleDur, { morphSVG:box}, { morphSVG:boxOpen, ease: Power3.easeInOut }, 0);

numTl
	.fromTo(numGroup, toggleDur*0.75,{ x:0 }, { x: -8, ease: Power3.easeInOut }, toggleDur*0.25)
	.fromTo(numGroup, toggleDur,{ y:0 }, { y:40, ease: Power3.easeInOut }, 0);

contentTl
	.fromTo(cartContent, toggleDur*0.6, { autoAlpha:0 }, { autoAlpha:1, ease: Power3.easeInOut }, toggleDur*0.4)
	.staggerFromTo(cartItems, toggleDur, { cycle:{ y:startY} }, { y:0, ease: Power3.easeInOut }, -staggerDur, 0)
	.staggerFromTo(cartItems, toggleDur, { x:120 }, { x:0, ease: Power3.easeInOut }, -staggerDur, toggleDur*0.15);

// Functions
function getClickCoords(e) {

	var svgRect = document.querySelector('#add-to-cart').getBoundingClientRect(),
		btnRect = document.querySelector('[data-anim=btn-bg]').getBoundingClientRect(),
		pixelCoordSample = btnRect.left-svgRect.left,
		svgCoordSample = 225.5,
		normFactor = pixelCoordSample/svgCoordSample,
		src = {
			x: e.clientX,
			y: e.clientY,
			xMin: btnRect.left,
			xMax: btnRect.left + btnRect.width,
			yMin: btnRect.top,
			yMax: btnRect.top + btnRect.height
		},		
		rpl = {
			xMin: -(btnRect.width)/2/normFactor,
			xMax: (btnRect.width)/2/normFactor,
			yMin: -(btnRect.height)/2/normFactor,
			yMax: (btnRect.height)/2/normFactor,
			offset: parseInt(ripple.getAttribute('r')),
		};

	var coords = {
		x: map(src.x, src.xMin, src.xMax, rpl.xMin, rpl.xMax) + rpl.offset,
		y: map(src.y, src.yMin, src.yMax, rpl.yMin, rpl.yMax) + rpl.offset
	};
	return coords;
}

// Returns a value on destination range based on the input value on source range
function map(value, sourceMin, sourceMax, destinationMin, destinationMax) {
	return destinationMin + (destinationMax - destinationMin) * ((value - sourceMin) / (sourceMax - sourceMin)) || 0;
}
            
          
!
999px
Loading ..................

Console