Code Sketch
BHAVESHart02
Category: Programming
// --- Kojo Vector Art: Tiranga Sudarshan Chakra with Ashok Chakra ---
cleari()
setBackground(Color(5, 2, 12)) // Dark Cosmic Background
// ?. ???????? ???? ???? (Ashok Chakra with 24 Spokes)
def drawAshokChakra(): Unit = {
val chakraRadius = 35.0
val navyBlue = Color(0, 56, 168) // Official Navy Blue Color
// Outer Ring of Ashok Chakra
val outerRing = Picture.circle(chakraRadius)
outerRing.setFillColor(Color(255, 255, 255)) // White Base
outerRing.setPenColor(navyBlue)
outerRing.setPenThickness(3)
outerRing.setPosition(0, 0)
draw(outerRing)
// Inner Hub
val hub = Picture.circle(6)
hub.setFillColor(navyBlue)
hub.setPenColor(navyBlue)
hub.setPosition(0, 0)
draw(hub)
// 24 Spokes (?? ?????)
for (i <- 0 until 24) {
val spokeAngle = Math.toRadians(i * (360.0 / 24))
val endX = chakraRadius * Math.cos(spokeAngle)
val endY = chakraRadius * Math.sin(spokeAngle)
val spoke = Picture.line(endX, endY)
spoke.setPenColor(navyBlue)
spoke.setPenThickness(2)
spoke.setPosition(0, 0)
draw(spoke)
}
}
// ?. ??????? ?????? ??? ?????????? ??? (Tiranga Background Aura)
def drawCoreAura(): Unit = {
// ????? ??? (Green)
val greenAura = Picture.circle(135)
greenAura.setFillColor(Color(18, 136, 7, 40))
greenAura.setPenColor(noColor)
greenAura.setPosition(0, 0)
draw(greenAura)
// ??????/???? ??? (White & Light Blue)
val midAura = Picture.circle(95)
midAura.setFillColor(Color(255, 255, 255, 60))
midAura.setPenColor(noColor)
midAura.setPosition(0, 0)
draw(midAura)
// ????? ??? (Saffron)
val saffronAura = Picture.circle(60)
saffronAura.setFillColor(Color(255, 153, 51, 80))
saffronAura.setPenColor(noColor)
saffronAura.setPosition(0, 0)
draw(saffronAura)
}
// ?. ????????? ??????? ?????? (Tiranga Sacred Geometry Rings)
def drawSudarshanRings(): Unit = {
// ????? ???? (Saffron Ring)
val ringSaffron = Picture.circle(70)
ringSaffron.setFillColor(noColor)
ringSaffron.setPenColor(Color(255, 153, 51))
ringSaffron.setPenThickness(3)
ringSaffron.setPosition(0, 0)
draw(ringSaffron)
// ????? ???? (Green Ring)
val ringGreen = Picture.circle(115)
ringGreen.setFillColor(noColor)
ringGreen.setPenColor(Color(18, 136, 7))
ringGreen.setPenThickness(3)
ringGreen.setPosition(0, 0)
draw(ringGreen)
}
// ?. ???????????????? ????????? ????????? ???? (Rotating Tiranga Blades)
def drawChakraBlades(rotationAngle: Double): Unit = {
val totalBlades = 36
val radiusInner = 70.0
val radiusOuter = 115.0
for (i <- 0 until totalBlades) {
val angle = Math.toRadians((i * (360.0 / totalBlades)) + rotationAngle)
val nextAngle = Math.toRadians(((i + 0.5) * (360.0 / totalBlades)) + rotationAngle)
// ?????? ??????? ?????? (Saffron, White, Green Blade Pattern)
val bladeColor = if (i % 3 == 0) {
Color(255, 153, 51, 230) // ????? (Saffron)
} else if (i % 3 == 1) {
Color(255, 255, 255, 230) // ?????? (White)
} else {
Color(18, 136, 7, 230) // ????? (Green)
}
// ?????? ???? (Blades)
val blade = Picture.fromVertexShape { p =>
p.beginShape()
p.vertex(radiusInner * Math.cos(angle), radiusInner * Math.sin(angle))
p.vertex(radiusOuter * Math.cos(nextAngle), radiusOuter * Math.sin(nextAngle))
p.vertex((radiusInner + 10) * Math.cos(angle + 0.2), (radiusInner + 10) * Math.sin(angle + 0.2))
p.endShape()
}
blade.setFillColor(bladeColor)
blade.setPenColor(Color(0, 56, 168)) // Blue Border
blade.setPenThickness(1)
draw(blade)
// ????????? ?????????? ?????? (Rays)
val rayX = (radiusOuter + 20) * Math.cos(nextAngle)
val rayY = (radiusOuter + 20) * Math.sin(nextAngle)
val ray = Picture.line(rayX - (radiusOuter * Math.cos(nextAngle)), rayY - (radiusOuter * Math.sin(nextAngle)))
ray.setPenColor(Color(255, 255, 255, 180))
ray.setPenThickness(1)
ray.setPosition(radiusOuter * Math.cos(nextAngle), radiusOuter * Math.sin(nextAngle))
draw(ray)
}
}
// ?. ????? ????? (Title Text)
def drawText(): Unit = {
val title = Picture.text("BHARAT MATA KI JAI", 18)
title.setPenColor(Color(255, 153, 51)) // ????? ???
title.setPosition(-115, 160)
draw(title)
val subtitle = Picture.text("TRICOLOR SUDARSHAN CHAKRA", 10)
subtitle.setPenColor(Color(18, 136, 7)) // ????? ???
subtitle.setPosition(-95, 138)
draw(subtitle)
}
// ?. ??? ????????? ??? ??????? ????????? ????? (Continuous Animation Loop)
animateWithState(0.0) { angle =>
erasePictures()
drawCoreAura() // ?. ?????? ???
drawSudarshanRings() // ?. ????????? ??????? ??????
drawChakraBlades(angle) // ?. ??????? ???? (Saffron, White, Green)
drawAshokChakra() // ?. ????????? ?? ???????? ???? ????
drawText() // ?. ????? ?????
(angle + 4.0) % 360.0 // ??? ????? ?????? ?????
}