sub()
함수, 내장 함수 분류
a - b as a free function.
import { sub } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function sub<E extends string, N extends number>( a: ReadonlyNode<E>, b: ReadonlyNode<`vec${N}<${E}>`>,): Node<`vec${N}<${E}>`>;function sub<K extends string>(a: ReadonlyNode<K>, b: ArithArg<K>): Node<K>;function sub<K extends string>(a: number, b: ReadonlyNode<K>): Node<K>;매개변수
aReadonlyNode<E>bReadonlyNode<`vec${N}<${E}>`>
반환값
Node<`vec${N}<${E}>`>
예외
TypeErrorboth operands are plain numbers.
설명
sub(1, smoothstep(e0, e1, x)) is the inverted-ramp idiom the
method form has to spell f32(1).sub(...); both emit (1.0 - smoothstep(...)).
Whichever operand is a node types the other. Two bare numbers are rejected.
예제
예제
import { fn, sub, smoothstep, f32T } from 'typeshade'
const rim = fn('rim', { d: f32T }, ({ d }) => sub(1, smoothstep(0, 1, d)))관련 가이드
함께 보기
소스
src/core/ir/node.ts, 1195행, 커밋 c66579bf 기준