Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datkt/lerp

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datkt/lerp

Simple linear interpolation function for Kotlin

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

datkt.lerp

Simple linear interpolation function for Kotlin

Installation

$ npm install @datkt/lerp

Usage

$ konanc -r node_modules/@datkt/lerp -l lerp index.kt
$ ./program.kexe
import datkt.lerp.*

fun main(args: Array<String>) {
  val x = toDouble(0, args, 0.123)
  val y = toDouble(1, args, 0.456)
  val t = toDouble(2, args, 0.5)

  println("lerp(${x}, ${y}, ${t})=${lerp(x, y, t)}")
}

fun toDouble(i: Int, args: Array<String>, default: Double): Double {
  val n = if (args.size > i + 1) args[i] else null

  if (null != n && n.length > 0) {
    return n.toDouble()
  }

  return default
}

API

val z = lerp(x: Double, y: Double, t: Double): Double

Compute the linear interpolation between two points x and y with a factor of t.

val z = lerp(1.0, 2.0, 1.0) // z=2.0

License

MIT

Keywords

FAQs

Package last updated on 07 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc