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.

            
              <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
Loading ..................

Console