🤠
cedoscript
  • Introduction
  • Documentation
    • Packets
    • Setting Command
    • Java Imports
    • Examples
      • Creating a Pack
      • Custom Block Animation
      • Bhop
      • Setting Creation
      • Post Notification
      • Gradient Round Rectangle
      • Applying a gradient
      • Simulate a command
  • api
    • Events
    • Settings
    • Objects
      • EntityLivingBase
      • ItemStack
      • Player Abilities
      • Color
      • TimerUtil
      • Continual Animation
      • ShaderUtil
      • FrameBuffer
      • Rainbow
      • Drag
      • Pair
      • Module
  • Bindings
    • Client
    • Player
    • Packet
    • Action
    • Facing
    • Potion
    • Notification
    • Render
    • Stats
    • Font
    • User
    • World
Powered by GitBook
On this page

Was this helpful?

  1. Documentation
  2. Examples

Applying a gradient

Displays how to apply a gradient to something

PreviousGradient Round RectangleNextSimulate a command

Last updated 2 years ago

Was this helpful?

var script = initScript({    
    name: "test colors",    
    description: "This is the description",    
    author: "cedo"
})

script.onRender2D(function (event) {    
    var colors = client.getClientColors()    
    var white = color({ red: 255, green: 255, blue: 255 })
    var font = font.getMinecraftFontRenderer()    
    var textSize = font.getStringWidth(text)    
    var textHeight = font.getFontHeight()    
    
    render.applyGradient(300,300, textSize, textHeight, 1, colors.getFirst(), 
        colors.getFirst(), colors.getSecond(), colors.getSecond(), function () {       
            font.drawString("Cedo Moment", 300, 300, white)    
    })
})
Final result is a smooth gradient over some text