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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <svg id="drawing" height="400" width="400" viewBox="0 0 400 400"></svg>
            
          
!
            
              $ligthergray: #EEEEEE;
$line-1: rgb(0, 83, 159);
$line-2: rgb(0, 138, 97);
$line-3: rgb(239, 64, 33);
$line-5: rgb(165, 68, 153);
$line-15: rgb(133, 141, 143);
svg {
	display: block;
	background-color: $ligthergray;
	margin: 1rem auto 0;
	border: 1rem solid $ligthergray;
	.line-1  { fill: $line-1; transition: fill 1s ease;}
	.line-2  { fill: $line-2; transition: fill 1s ease;}
	.line-3  { fill: $line-3; transition: fill 1s ease;}
	.line-5  { fill: $line-5; transition: fill 1s ease;}
	.line-15 { fill: $line-15; transition: fill 1s ease;}
}
.coursePoint { fill: white; }
            
          
!
            
              				////////////////////////////////////////////////////////////////////////////////
				// Select the SVG element, and define a 'course' group with baisc SVG objects
				const s = Snap("#drawing")
				const courseObj = {
					path: s.path("M50.0,100.0 C22.39,100.0,0,77.61,0,50.0 S22.39,0,50.0,0 h300.0 c27.61,0,50.0,22.39,50.0,50.0 s-22.39,50.0 -50.0,50.0 H50.0z").attr({class:"coursePath"}),
					pointA: s.circle( 50.0, 50, 31.25).attr({class:"coursePoint"}),
					pointB: s.circle(350.0, 50, 31.25).attr({class:"coursePoint"}),
				}
				const course = s.g(courseObj.path, courseObj.pointA, courseObj.pointB).toDefs()
				////////////////////////////////////////////////////////////////////////////////
				// Define 'row' groups using 'course' in diferent positions
				const xPad = 31.25
				const xBase = 200+xPad
				let rows = {
					r1: {
						e1: course.use().attr({transform:"t            0,0"}),
						e2: course.use().attr({transform:"t"+ xBase* 2+",0"}),
						e3: course.use().attr({transform:"t"+ xBase* 4+",0"}),
						e4: course.use().attr({transform:"t"+ xBase* 6+",0"}),
						e5: course.use().attr({transform:"t"+ xBase* 8+",0"}),
						e6: course.use().attr({transform:"t"+ xBase*10+",0"}),
						e7: course.use().attr({transform:"t"+ xBase*12+",0"})
					},
				 	r2: {
						e1: course.use().attr({transform:"t            0,0"}),
						e2: course.use().attr({transform:"t"+ xBase* 2+",0"}),
						e3: course.use().attr({transform:"t"+ xBase* 4+",0"}),
						e4: course.use().attr({transform:"t"+ xBase* 6+",0"}),
						e5: course.use().attr({transform:"t"+ xBase* 8+",0"}),
						e6: course.use().attr({transform:"t"+ xBase*10+",0"}),
						e7: course.use().attr({transform:"t"+ xBase*12+",0"})
					},
				 	r3: {
						e1: course.use().attr({transform:"t            0,0"}),
						e2: course.use().attr({transform:"t"+ xBase* 2+",0"}),
						e3: course.use().attr({transform:"t"+ xBase* 4+",0"}),
						e4: course.use().attr({transform:"t"+ xBase* 6+",0"}),
						e5: course.use().attr({transform:"t"+ xBase* 8+",0"}),
						e6: course.use().attr({transform:"t"+ xBase*10+",0"}),
						e7: course.use().attr({transform:"t"+ xBase*12+",0"})
					}
				}
				let row1 = s.g(rows.r1.e1, rows.r1.e2, rows.r1.e3, rows.r1.e4, rows.r1.e5, rows.r1.e6, rows.r1.e7).toDefs()
				let row2 = s.g(rows.r2.e1, rows.r2.e2, rows.r2.e3, rows.r2.e4, rows.r2.e5, rows.r2.e6, rows.r2.e7).toDefs()
				let row3 = s.g(rows.r3.e1, rows.r3.e2, rows.r3.e3, rows.r3.e4, rows.r3.e5, rows.r3.e6, rows.r3.e7).toDefs()
				// position each 'row'
				row1.attr({transform:"translate("+-xBase*12+",0)"})
				row2.attr({transform:"translate("+-xBase*13+",150)"})
				row3.attr({transform:"translate("+-xBase*12+",300)"})
				// animate each 'row'
				row1.animate({transform:"t         0,0"  }, 2500, mina.easein)
				row2.animate({transform:"t"+-xBase+",150"}, 2500, mina.backin)
				row3.animate({transform:"t         0,300"}, 2500, mina.easeout)
				// append each 'row' to the SVG element
				s.append(row1)
				s.append(row2)
				s.append(row3)

				////////////////////////////////////////////////////////////////////////////////
				// let css class names for SVG 'course' fills
				let colors = {
					list: ['line-1', 'line-2', 'line-3', 'line-5', 'line-15'],
					random: ()=>colors.list[Math.floor(Math.random()*colors.list.length)]
				}
				// apply the colors, for set interval, after set timeout
				applyColors()
				setTimeout(()=>{
					setInterval(()=>applyColors(), 2000)
				}, 2500)
				function applyColors(){
					$('use')
					.removeClass()
					.each(function(){
						$(this).addClass(colors.random())
					})
				}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console