参数

    string contextType

    上下文类型

    Object contextAttributes

    webgl 上下文属性,仅当 contextType 为 webgl 时有效

    属性 类型 默认值 是否必填 说明 支持版本
    antialias boolean false 表示是否抗锯齿
    preserveDrawingBuffer boolean false 表示是否绘图完成后是否保留绘图缓冲区
    antialiasSamples number 2 抗锯齿样本数。最小值为 2,最大不超过系统限制数量,仅 iOS 支持

    返回值

    RenderingContext