Advertisement
hellom38

Test

Aug 16th, 2022
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const km = kelvinUtil.math
  2. const width = 600
  3. const height = 600
  4. const bgColor = 'black'
  5. const bgOpacity = .05
  6. const color = {
  7.   red1: '#E74C3C',
  8.   red2: '#C0392B',
  9.   orange1: '#E67E22',
  10.   orange2: '#D35400',
  11.   yellow1: '#F1C40F',
  12.   yellow2: '#F39C12',
  13.   green1: '#2ECC71',
  14.   green2: '#27AE60',
  15.   mint1: '#1ABC9C',
  16.   mint2: '#16A085',
  17.   blue1: '#3498DB',
  18.   blue2: '#2980B9',
  19.   purple1: '#9B59B6',
  20.   purple2: '#8E44AD',
  21.   light1: '#ECF0F1',
  22.   light2: '#BDC3C7',
  23.   grey1: '#95A5A6',
  24.   grey2: '#7F8C8D',
  25.   dark1: '#34495E',
  26.   dark2: '#2C3E50',
  27. }
  28.  
  29. let mouseX = 0
  30. let mouseY = 0
  31. let frameCount = 0
  32. let ss = []
  33. let ss2 = []
  34. let num = 0
  35.  
  36. let stage = new Konva.Stage({
  37.   container: 'container',
  38.   width: width,
  39.   height: height
  40. })
  41.  
  42. let layer = new Konva.FastLayer({
  43.   clearBeforeDraw: false
  44. })
  45. stage.add(layer)
  46.  
  47. let bg = new Konva.Rect({
  48.   x: 0,
  49.   y: 0,
  50.   width: width,
  51.   height: height,
  52.   fill: bgColor,
  53.   opacity: bgOpacity
  54. })
  55. layer.add(bg)
  56. bg.moveToBottom()
  57.  
  58. // stats
  59. let stats = new Stats()
  60. stats.showPanel(0)
  61. stats.domElement.className += ' stats'
  62. document.body.appendChild(stats.domElement)
  63.  
  64. new Konva.Animation(frame => {
  65.   stats.begin()
  66.  
  67.   for (let i = 0; i < 360; i++) {
  68.     let shit
  69.     if (typeof ss[i] === 'undefined') {
  70.       shit = new Konva.Circle({
  71.         radius: 3,
  72.         x: 0,
  73.         y: 0,
  74.         fill: 'white',
  75.           globalCompositeOperation: 'lighter'
  76.       })
  77.       layer.add(shit)
  78.       ss.push(shit)
  79.     }
  80.     else {
  81.       shit = ss[i]
  82.     }
  83.     let angle = km.cos(km.radians(i * 22 + num)) * 460
  84.     let x = width / 2 + km.sin(km.radians(i)) * angle
  85.     let y = height / 2 + km.cos(km.radians(i)) * angle
  86.     let c = tinycolor({ h: frameCount % 360, s: 100, l: 50 })
  87.     shit.x(x)
  88.     shit.y(y)
  89.     shit.fill(c.toHexString())
  90.   }
  91.   num += .5
  92.   frameCount++
  93.  
  94.   stats.end()
  95. }, layer).start()
  96.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement